home *** CD-ROM | disk | FTP | other *** search
/ Winzipper / Winzipper_ISO.iso / internet / net commander 1.0 / ISP / SCRPTLST / CYBRSPAC.CMD < prev    next >
Encoding:
Text File  |  1996-02-15  |  4.1 KB  |  198 lines

  1. #    Cyberspace Login.cmd
  2. #
  3. #  Trumpet Winsock 2.1 Login.cmd
  4. #
  5. #  Copyright (C) 1994,1995 Peter R. Tattam & 
  6. #  Trumpet Software International Pty Ltd (TSI)
  7. #  All rights reserved.
  8. #
  9. #  Unless TSI has given prior written consent to such use, 
  10. #  no permission is granted to distribute or otherwise make available 
  11. #  to the public modified versions of this script for commercial purposes.  
  12. #  Any permitted distribution of modified versions of the script must
  13. #  retain the copyright notice at the start of this file and must clearly 
  14. #  identify those parts of the file which have been modified.
  15. #
  16. #trace on
  17. #
  18. # set up some strings for dialling up
  19. #
  20. if ![load $number]
  21.   if [query $number "Enter your dial up phone number"]
  22.     save $number
  23.   end
  24. end
  25. if ![load $username]
  26.   if [username "Enter your login username"]
  27.     save $username
  28.   end
  29. end
  30. if ![load $password]
  31.   if [password "Enter your login password"]
  32.     save $password
  33.   end
  34. end
  35. $modemsetup = "&c1&k3m0"
  36. $prompt = ">"
  37. $userprompt = "ogin:"
  38. $passprompt = "assword:"
  39. $slipcmd = "slip"
  40. $addrtarg = "our address is"
  41. $pppcmd = "ppp"
  42. $pppready = "PPP."
  43. %attempts = 10
  44.  
  45. ###############################################
  46. # timeouts for various sections of the script #
  47. ###############################################
  48. #
  49. # timeout for busy tone... adjust this until the BUSY string is detected.
  50. #
  51. %busytimeout = 10
  52. #
  53. # time between successive busy attempts.
  54. #
  55. %busywait = 30
  56. #
  57. # time to wait for a CONNECT string to be received
  58. #
  59. %connecttimeout = 60
  60. #
  61. # time to wait until DCD is detected
  62. #
  63. %onlinetimeout = 60
  64. #
  65. # time to wait for username & password prompts
  66. #
  67. %logintimeout = 60
  68. #
  69. # time to wait for server prompt to appear
  70. #
  71. %prompttimeout = 30
  72. #
  73. # time to wait for a SLIP address to be parsed
  74. #
  75. %addresstimeout = 30
  76. #
  77. # time to wait for a terminal-type prompt
  78. #
  79. %termwait = 10
  80. #
  81. # terminal-type prompt
  82. #
  83. $termprompt = "ERM = (vt100) [1;24r[24;1H"
  84. #
  85. # Cyberspace message delay
  86. #
  87. %msgdelay = 5
  88. #
  89. #----------------------------------------------------------
  90. #
  91. # initialize modem
  92. #
  93. status "Initializing modem..."
  94. output "atz"\13
  95. if ! [input 5 OK\n]
  96.   message "Modem is not responding"
  97.   abort
  98. end
  99. #
  100. # setup our modem commands
  101. #
  102. output "at"$modemsetup\13
  103. if ! [input 10 OK\n]
  104.   message "Modem is not responding"
  105.   abort
  106. end
  107. #
  108. # send phone number
  109. #
  110. %n = 0
  111. repeat
  112.   %n = %n + 1
  113.   if %n > %attempts
  114.     message "Too many dial attempts"
  115.     abort
  116.   end
  117.   status Dialling $number...(attempt %n)
  118.   output "atdt"$number\13
  119.   %busy = [input %busytimeout BUSY]
  120.   if %busy
  121.     status "The line is busy...pausing for a while"
  122.     sleep %busywait
  123.     %ok = 0
  124.   else
  125.     %ok = [input %connecttimeout CONNECT]
  126.   end
  127. until %ok
  128. input 10 \n
  129. #
  130. #  wait till it's safe to send because some modem's hang up
  131. #  if you transmit during the connection phase
  132. #
  133. wait %onlinetimeout dcd
  134. status Connected.  Now logging in as $username...
  135. #
  136. #  wait for the username prompt
  137. #
  138. input %logintimeout $userprompt
  139. output $username\n
  140. #
  141. # and the password
  142. #
  143. input %logintimeout $passprompt
  144. output $password\n
  145. #
  146. # Wait a bit for all the login messages to pass
  147. #
  148. # sleep %msgdelay
  149. #
  150. # Now to deal with the "what terminal are you" prompt
  151. #
  152. #input %logintimeout $termprompt
  153. #output "TTY"\13
  154. output tty\13
  155. #
  156. # we are now logged in
  157. #
  158. status "Logged in. Now switching to Internet..."
  159. input %prompttimeout $prompt
  160. if %ppp
  161.   #
  162.   # jump into ppp mode
  163.   #
  164.   output $pppcmd\13
  165.   #
  166.   # wait for PPP prompt.
  167.   sleep 2
  168.   #
  169.   display \n\n"PPP mode selected.  Will try to negotiate IP address."\n
  170.   status "PPP mode selected.  Will try to negotiate IP address."
  171.   sleep 1
  172.   #
  173. else
  174.   #
  175.   # jump into slip mode
  176.   #
  177.   output $slipcmd\13
  178.   #
  179.   # wait for the address string
  180.   #
  181.   input %addresstimeout $addrtarg
  182.   #
  183.   # parse address
  184.   #
  185.   address 30
  186.   input %addresstimeout \n
  187.   #
  188.   # we are now connected, logged in and in slip mode.
  189.   #
  190.   display \n
  191.   display Connected.  Your IP address is \i.\n
  192.   status Connected.  Your IP address is \i.
  193.   sleep 1
  194. end
  195. #
  196. # now we are finished.
  197. #
  198.